package myJs.api

import myJs.myPkg.MyFetch
import myJs.tool.Pojo.Basic344TpmData
import upickle.default.read

import scala.concurrent.ExecutionContext.Implicits.global
import myJs.Implicits._

/**
 * Created by yz on 25/5/2022
 */
object TpmApi {

  val baseUrl = s"${Api.apiUrl}/nut/tpm"

  def all = {
    val url = s"${baseUrl}/all"
    MyFetch.getRnStr(url = s"${url}").map { str =>
      read[List[ujson.Obj]](str)
    }
  }

  def allByServer(dataStr: String) = {
    val url = s"${baseUrl}/allByServer"
    MyFetch.postRnText(url = s"${url}", data = dataStr, headers = Map("Content-Type" -> "application/json")).map { str =>
      str.toObj
    }
  }



}
